<template>
  <el-card>
    <template #header>
      <div class="clearfix">
        <span>充电站列表</span>
        <el-button @click="router.push('/home/partner/investors/add')" style="float: right; padding: 3px 0" type="text">添加</el-button>
      </div>
    </template>
    <el-table :data="chargingStationsList" style="width: 100%">
      <el-table-column prop="id" label="序号"></el-table-column>
      <el-table-column prop="stationName" label="站点名称"></el-table-column>
      <el-table-column prop="stationType" label="站点属性"></el-table-column>
      <el-table-column prop="chargerCount" label="充电桩数量"></el-table-column>
      <el-table-column prop="address" label="详细地址"></el-table-column>
      <el-table-column prop="ratingEnabled" label="是否开启评价">
        <template #default="scope">
          {{ scope.row.ratingEnabled ? '是' : '否' }}
        </template>
      </el-table-column>
      <el-table-column prop="creationTime" label="创建时间" ></el-table-column>
      <el-table-column prop="status" label="状态" ></el-table-column>
    </el-table>
  </el-card>
</template>

<script setup lang="ts">
import { ref } from 'vue';
import { fetchChargingStationsList } from "../../../../api/ChargingStationsApi.ts";
import router from "../../../../router";

const chargingStationsList = ref([]);

const getChargingStationsList = async () => {
  const res = await fetchChargingStationsList();
  if (res.code === 200) {
    chargingStationsList.value = res.data
  }
};


getChargingStationsList();

</script>

<style scoped>
.el-card {
  margin-top: 20px;
  border: 1px solid rgba(0, 0, 0, 0.2);
  box-shadow: 0 0 0 #ffffff;
  outline: 0;
}
</style>
